#include <stdlib.h>
#include <stdio.h>
#include "data.h"



struct S{
	int * value;
	S():value(new int(1)){};
	~S(){delete (value); printf("removed\n");};
};

void print_line(S *s)
{
	printf("number %d \n", *s->value);
}

int main(int argv, char ** argc)
{
	//load_config("input.txt");
	if(argv == 2){
           printf("Load configuration from file:%s\n", argc[1]);
	   crailway railway;
	   railway.loadconfiguration(argc[1]);
	   railway.simulate_trains();
	   /*******************************
	   S s;
	   print_line(&s);
	   printf("number %d", *s.value);
	   ********************************/
	}else{
           printf("Usage %s <data file>\n", argc[0]);
           printf("%s version %d.%d\n",argc[0], MAJOR_VERSION,MINOR_VERSION);
	}
}


/***********************************
*  Program train
* Simple input file:
* 1 row - number of stations;number of connections
* connections -> station_no_x;length;station_no_y 
* ....... n rows
* number of trains;train_no
* n rows with train route plan (t1,s1,s5,s7,s8) 
*
* Lets assume the connection is simple 
* make a simple loop, where each train make a one step (the same speed)
* we assume that train spends a one "time" step on station
* Each train to object CTrain <- keeps the path of train
* if the train has no direct connection from s1 to sn, check the shortest way (extra)
* and for that train doesn't spend a time on station (just passes it)
* Program just execute the step on each objects
* each train return the pair of numbers (track_no and current position on track (0..track_length)
* but we have to take that position is 0 for sn and length for sn+1 to know where the colission happened
* 
* Data representation
* It is a simple list 
* station keeps a pointer to another stations (edges)
* there is an object connection Sn,lenght,Sn+1
* but we want to keep in one structure
* so do it that way 
* simple structure  station ->(n) *(station_no, length)
* 
*************************************/
